package com.vspush.web.controller;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.vspush.cache.Cache;
import com.vspush.manage.MessageManage;

@Controller
public class WebController extends BaseController{
	
	MessageManage mm = new MessageManage();
	
	@RequestMapping(value = "index")
	public Object index(){
		
		return "index";
	}
	@RequestMapping(value = "user")
	public Object user(){
		return Cache.online();
	}
	
	@RequestMapping(value = "send")
	public Object send(String id,String msg){
		mm.sendMessage(id, msg);
		List<String> ulist = new ArrayList<String>();
		ulist.add("success");
		return ulist;
	}
	
	@RequestMapping(value = "reg")
	public Object reg(){
		String usernam = UUID.randomUUID().toString().replaceAll("-", "").substring(0, 6);
		return super.setMessage(usernam, usernam);
	}

}
